package com.aaa.marketresearch.android.data.domain;

import org.json.simple.JSONObject;

import java.io.Serializable;

/**
 * @author Nail
 */
public class BillContent implements Serializable {

    private static final long serialVersionUID = 1L;

    private Offer offer;

    private Market market;

    private FamilyMember familyMember;

    private Double capacity;

    private Double payedValue;

    public Offer getOffer() {
        return offer;
    }

    public void setOffer(Offer offer) {
        this.offer = offer;
    }

    public Market getMarket() {
        return market;
    }

    public void setMarket(Market market) {
        this.market = market;
    }

    public FamilyMember getFamilyMember() {
        return familyMember;
    }

    public void setFamilyMember(FamilyMember familyMember) {
        this.familyMember = familyMember;
    }

    public Double getCapacity() {
        return capacity;
    }

    public void setCapacity(Double capacity) {
        this.capacity = capacity;
    }

    public Double getPayedValue() {
        return payedValue;
    }

    public void setPayedValue(Double payedValue) {
        this.payedValue = payedValue;
    }

    public BillContent() {
        this.offer = null;
        this.capacity = 1.0;
        this.payedValue = 0.0;
    }

    public BillContent makeSame() {
        BillContent billContent = new BillContent();
        billContent.setMarket(market);
        billContent.setFamilyMember(familyMember);
        return billContent;
    }

    public JSONObject getJSON() {
        JSONObject json = new JSONObject();

        json.put("offerId", offer.getId());
        json.put("marketId", market.getId());
        json.put("familyMemberId", familyMember.getId());
        json.put("capacity", capacity);
        json.put("payedValue", payedValue);

        return json;
    }


}
